package com.chushouya.controller.order.admin;


import com.chushouya.common.constant.ServiceType;
import com.chushouya.common.support.Contexts;
import com.general.framework.core.schema.Response;
import com.chushouya.order.dto.admin.orderlog.OrderLogDTO;
import com.chushouya.order.service.admin.AdminOrderLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


@Slf4j
@Api(tags = ServiceType.PLATFORM + "平台订单日志管理")
@RestController
@RequestMapping(ServiceType.PLATFORM + "/orderLog")
public class OrderLogController {

    @Resource
    private AdminOrderLogService adminOrderLogService;

    @ApiOperation("获取订单日志列表接口")
    @GetMapping("/list")
    public Response<List<OrderLogDTO>> list(Long orderId) {
        return Response.success(adminOrderLogService.selectOrderLogList(orderId));
    }

    @ApiOperation("获取合作商订单日志接口")
    @GetMapping("/partnerList")
    public Response<List<OrderLogDTO>> partnerList(Long orderId) {
        final Long partnerId = Contexts.getUserContext().getPartnerId();
        return Response.success(adminOrderLogService.selectPartnerOrderLogList(orderId,partnerId));
    }

}
